package com.xxlie.auth.security.auth.ajax;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;

/**
 * 通过手机号注册请求
 *
 *
 * @author xxlie.com
 * @since 2017/9/27
 */
public class RegisterPhoneRequest {

    private String username;
    private String password;
    private String phone;
    private String smsCode;
    
    private String type;
    private Long inviterId;

    @JsonCreator
    public RegisterPhoneRequest(@JsonProperty("password") String password, @JsonProperty("phone") String phone, @JsonProperty("smsCode") String smsCode) {
        this.username = phone;
        this.password = password;
        this.phone = phone;
        this.smsCode = smsCode;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @NotNull(message = "密码不能为空")
    @Length(min = 4, max = 20, message = "密码长度在6-20位数之间")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @NotNull(message = "手机号不能为空")
    @Length(min = 11, max = 15, message = "请输入正确的手机号")
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @NotNull(message = "验证码不能为空")
    @Length(min = 6, max = 6, message = "验证码为6位数")
    public String getSmsCode() {
        return smsCode;
    }

    public void setSmsCode(String smsCode) {
        this.smsCode = smsCode;
    }

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Long getInviterId() {
		return inviterId;
	}

	public void setInviterId(Long inviterId) {
		this.inviterId = inviterId;
	}
}
